import { lazy } from "react";
import { Navigate } from "react-router-dom";
import { AppOutline, UserOutline } from "antd-mobile-icons";

const Layout = lazy(() => import("../pages/Layout"));
const Login = lazy(() => import("../pages/Login"));
const Home = lazy(() => import("../pages/Home"));
const My = lazy(() => import("../pages/My"));
const City = lazy(() => import("../pages/City"));

export const tabberRouter = [
  {
    path: "/home",
    meta: {
      title: "首页",
      icon: <AppOutline />,
    },
    element: <Home />,
  },
  {
    path: "/my",
    meta: {
      title: "我的",
      icon: <UserOutline />,
    },
    element: <My />,
  },
];

const router = [
  {
    path: "/",
    element: <Layout />,
    children: [
      ...tabberRouter,
      {
        path: "/",
        element: <Navigate to="/home" />,
      },
    ],
  },
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/city",
    element: <City />,
  }
];
export default router;
